<template>
	<view class="mypop">
		<u-popup :show="showPop" mode="bottom" height="300px" customStyle="width:100%" :round="10">
			<view class="p-3">
				<view class="" style='position: absolute;right: 40rpx;z-index: 10;'>
					<u-icon name="close" size="20" @click="refuse"></u-icon>
				</view>
				<view class="title" style="text-align: center;color: #081738;font-weight: 500;">
					{{title}}
				</view>
				<scroll-view scroll-y="false" style="height: 300px;" @scrolltolower="lower">
					<view class="scroll-content">
						<view class="center">
							<!-- <view class="title">
								全部商品
							</view> -->
							<view class="list" v-for="(item,index) in list.log" :key="index">
								<view class="item">
									<view class="name">
										{{item.card_type_name}}:{{item.number}}次
									</view>
									<view class="price">
										剩余：{{item.residue}}次
									</view>
								</view>
							</view>
							<view class="des" style="color: #545454;">
								{{list.illustrate}}
							</view>
						</view>
					</view>
				</scroll-view>
				<view class="jc-sb" style="align-items: center;justify-content: center;">
					<view style="width: 35%;"  @click="refuse">
						<u-button class="custom-style" text="关闭" color="#fff"
							customStyle="background: linear-gradient(90deg, #2CB9A4 0%, #2CB9A4 100%);color:#fff;border-radius: 20px;">
						</u-button>
					</view>
				</view>
			</view>
		</u-popup>
	</view>
</template>


<script>
	import {
		usableCoupons
	} from '@/request/api.js'
	export default {
		props: ['showPop', 'title', 'tip','listData'],
		data() {
			return {
				form: {
					page: 1
				},
				last_page: 1,
				show: false,
				value: '',
				list: [
				],
				price:0
			}
		},
		watch:{
			listData:{
				handler(newVal){
					// console.log(newVal,'新的值')
					this.list = newVal
				},
				deep:true
			}
		},
		methods: {
			lower: function(e) {
				console.log('到达底部吧')
				this.$emit('upDateList')
				// if (this.form.page < this.last_page) {
				// 	this.form.page = this.form.page + 1
				// }
			},
			pay(){
				// uni.navigateTo({
				// 	url:'/components/index/paySuccess?title=支付成功'
				// })
			},
			checkedType(i) {
				this.list.forEach((item,index)=>{
					if(index!=i){
						item['checked'] = false
					}else{
						item['checked'] = !item['checked']
						this.price = item.price
					}
				})
				// this.listData[i].checked = !this.listData[i].checked
				this.$emit('upDateCheck', this.list)
				// this.$forceUpdate()
				console.log(this.list,'勾选的列表1')
			},
			// 注意返回值为一个数组，单列时取数组的第一个元素即可(只有一个元素)
			submit() {
				
			},
			refuse() {
				this.$emit('refuse', true)
			},
			
		}
	}
</script>

<style scoped lang="scss">
	::v-deep .u-icon {
		display: inline !important;
	}

	.mypop {
		width: 90%;
	}

	.scroll-content {
		display: flex;
		flex-direction: column;

		.top {
			display: flex;
			justify-content: space-between;
			margin-top: 40rpx;
			border-bottom: 0.5rpx solid rgba(217, 217, 217, 0.6);
			padding-bottom: 40rpx;

			.item {
				text-align: center;
				background: #F6F6F6;
				padding: 20rpx 40rpx;
				border-radius: 8px;

				.top1 {
					color: #081738;
					font-size: 34rpx;
				}

				.top2 {
					color: #979797;
					font-size: 28rpx;
				}
			}
		}

		.center {
			padding-bottom: 40rpx;
			padding-top: 20rpx;

			.title {}

			.list {
				display: flex;
				justify-content: space-between;
				align-items: center;

				.item {
					display: flex;
					justify-content: space-between;
					background: #C0EAE4;
					border-radius: 10px;
					width: 100%;
					padding: 30rpx;
					color: #2CB9A4;
					margin-right: 20rpx;
					margin-top: 20rpx;

					.name {}

					.price {}
				}

				.check {}
			}
			.des{
				margin-top: 20rpx;
			}
		}

		.bottom {}
	}
</style>